package com.zyg.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.zyg.pojo.Cladd;
import com.zyg.pojo.Major;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface MajorMapper extends BaseMapper<Major> {

    @Override
    @Select("select major_id,major_name,cladd_id from sys_major ${ew.customSqlSegment}")
    @Results({
            @Result(property = "majorId", column = "major_id"),
            @Result(property = "majorName", column = "major_name"),
            @Result(property = "cladd", column = "cladd_id", javaType = Cladd.class,
                    one = @One(select = "com.zyg.dao.CladdMapper.selectById"))
    })
    List<Major> selectList(IPage<Major> page, @Param(Constants.WRAPPER)Wrapper<Major> queryWrapper);
}